#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

const int N = 10;

char g[N][N];
bool col[N], dg[N * 2], udg[N * 2];
int n;

void dfs(int i)
{
    if (i >= n)
    {
        for (int i = 0; i < n; i++)  cout << g[i] << endl;
        cout << endl;
        return;
    }

    for (int j = 0; j < n; j++)
    {
        if (!col[j] && !dg[i - j + n] && !udg[i + j])
        {
            g[i][j] = 'Q';
            col[j] = dg[i - j + n] = udg[i + j] = true;
            dfs(i + 1);
            g[i][j] = '.';
            col[j] = dg[i - j + n] = udg[i + j] = false;
        }
    }
}

//int main()
//{
//    cin >> n;
//    for (int i = 0; i < n; i++)
//        for (int j = 0; j < n; j++)
//            g[i][j] = '.';
//
//    dfs(0);
//    return 0;
//}

int maxArea(int h, int w, vector<int>& horizontalCuts, vector<int>& verticalCuts) {
    sort(horizontalCuts.begin(), horizontalCuts.end());
    sort(verticalCuts.begin(), verticalCuts.end());
    int maxlen = 0, maxwide = 0;
    for (int i = 0; i <= horizontalCuts.size(); i++)
    {
        if (i == 0)
            maxwide = max(maxwide, horizontalCuts[0] - 0);
        else if (i == horizontalCuts.size())
            maxwide = max(maxwide, h - horizontalCuts[i - 1]);
        else
            maxwide = max(maxwide, horizontalCuts[i] - horizontalCuts[i - 1]);
    }

    for (int i = 0; i <= verticalCuts.size(); i++)
    {
        if (i == 0)
            maxlen = max(maxlen, verticalCuts[0] - 0);
        else if (i == verticalCuts.size())
            maxlen = max(maxlen, w - verticalCuts[i - 1]);
        else
            maxlen = max(maxlen, verticalCuts[i] - verticalCuts[i - 1]);
    }
    int mod = 1e9 + 7;
    int res = (long long)maxlen * maxwide % mod;
    return res;
}

int main()
{
    vector<int> v1 = { 3,1 };
    vector<int> v2 = { 1 };

    maxArea(5, 4, v1, v2);
    return 0;
}